/* feof example: byte counter */
#include <stdio.h>

int main()
{
  FILE *pFile;
  long n = 0;
  pFile = fopen("myfile.txt", "rb");
  if (pFile == NULL) 
    perror("Error opening file");
  else {
    while (!feof(pFile)) {
      fgetc(pFile);
      n++;
    }
    fclose(pFile);
    printf("Total number of bytes: %d\n", n-1);
  }
  return 0;
}
